<?php

namespace app\api\controller;

use app\common\model\Maintains as M;

class Finances extends Base
{

    public function initialize()
    {
        parent::initialize();
        $this->validateWXOpenid();
    }


    /**
     * 账单列表
     */
    public function list_my()
    {
        $openid = input('get.openid');

        $m = new M();
        $s = $m->getMaintains('page', $openid, true);

        if ($s)
            return js_return(1, 'success', $s);
        else
            return js_return(0, 'no data');
    }


    /**
     * 获取账单详情
     */
    public function detail()
    {
        $orderid = input('get.orderid');

        if (empty($orderid))
            return js_return(0, 'no orderid');

        $m = new M();
        $s = $m->getByOrderid($orderid);

        if ($s)
            return js_return(1, 'success', $s);
        else
            return js_return(0, 'no data');
    }

}
